<!DOCTYPE html>
<html>
<head>
<?php $this->load->view('head'); ?>
</head>
<body>
<?php $this->load->view('header'); ?>
<div class="container-fluid main">
	<div class="row">
<?php $this->load->view('left'); ?>
		<div class="main-content col-md-10">
<?php $this->load->view('crumbs'); ?>
			<div class="panel panel-default panel-my">
				<div class="panel-heading">
					<span class="mr10">栏目管理</span>
					<a class="btn btn-success btn-xs" href="<?php echo site_url('admin/category/add'); ?>" title="添加"><i class="glyphicon glyphicon-plus"></i> 添加</a>
				</div>
				<div class="panel-body">
					<form class="form-inline J-ajax-form" action="<?php echo site_url('admin/category/index'); ?>" method="post" accept-charset="utf-8" role="form">
						<div class="table-responsive">
							<table class="table table-striped table-hover">
								<thead>
									<tr>
										<th>[排序]栏目名称</th>
										<th class="text-center" width="60">#ID</th>
										<th width="60">状态</th>
										<th>管理</th>
									</tr>
								</thead>
								<tbody>
<?php if (!$cat_tree) { ?>
									<tr>
										<td colspan="4">啊哦！暂时还没有记录</td>
									</tr>
<?php } ?>
<?php
foreach ($cat_tree as $cat) {
	$plus_html = str_repeat('<i class="plus-none-icon"></i>', $cat['_depth']);
	$status_html = $cat['status'] == 0 ? '<span class="text-muted">关闭</span>' : ($cat['status'] == 1 ? '<span class="text-success">开启</span>' : '<span class="text-warning">隐藏</span>');
?>
									<tr>
										<td>
											<?php echo $plus_html; ?>
											<div class="form-group">
												<input class="form-control input-sm" style="width:45px;" type="text" name="data[<?php echo $cat['id']; ?>]vieworder" value="<?php echo $cat['vieworder']; ?>">
												<a class="mr5" href="<?php echo site_url('admin/post/index?cat_id=' . $cat['id']); ?>" title="列表"><?php echo $cat['title']; ?></a>
												<a href="#" title="访问"><i class="glyphicon glyphicon-share-alt"></i></a>
											</div>
										</td>
										<td class="text-center"><?php echo $cat['id']; ?></td>
										<td><?php echo $status_html; ?></td>
										<td>
											<a class="mr5" href="<?php echo site_url('admin/category/edit?id=' . $cat['id']); ?>">编辑</a>
											<a href="<?php echo site_url('admin/category/dodel?id=' . $cat['id']); ?>">删除</a>
										</td>
									</tr>
<?php
}
?>
								</tbody>
							</table>
						</div>
						<!--/.table-responsive -->
<?php if ($cat_tree) { ?>
						<div class="btn-wrap">
							<button type="submit" class="btn btn-primary J-ajax-submit-btn mr10">确认提交</button>
						</div>
<?php } ?>
					</form>
				</div>
				<!--/.panel-body -->
			</div>
			<!--/.panel -->
		</div>
		<!--/.main-content -->
	</div>
	<!--/.row -->
</div>
<!--/.container-fluid -->
<?php $this->load->view('footer'); ?>
</body>
</html>